package answer

func findErrorNums(nums []int) []int {
	tempMap := make(map[int]int)
	for _, num := range nums {
		tempMap[num]++
	}
	ans := make([]int, 2)
	for i := 1; i <= len(nums); i++ {
		if value := tempMap[i]; value == 2 {
			ans[0] = i
		} else if value == 0 {
			ans[1] = i
		}
	}
	return ans
}
